<template>
  <article class="base-info">
    <AuthTbUserUpdate ref="updaterRef" :id="currentUser?.userId" resource="baseinfo"></AuthTbUserUpdate>
    <footer>
      <n-button type="primary" @click="handleUpdate">更新</n-button>
    </footer>
  </article>
</template>

<script lang="ts" setup>
import AuthTbUserUpdate from '@/views/AuthTbUser/AuthTbUserUpdate.vue';
import { SlashAppContext } from 'slash-admin';
import { ref, onMounted } from 'vue';
import { getCurrentUser } from './httpApi';

const updaterRef = ref()
const currentUser = ref()

async function handleUpdate() {
  await updaterRef.value?.doUpdate()
  window.$message.success('更新成功')
}

onMounted(async () => {
  const res = await getCurrentUser()
  if (res.code == 200) {
    currentUser.value = res.data
  }
  console.log('currentUser', currentUser.value)
})
</script>

<style lang="less" scoped>
.base-info {
  width: 70%;
}
footer {
  overflow: hidden;
  .n-button {
    float: right;
  }
}
</style>